package com.ysw.http系列.rest_template;

import com.ysw.bean.User;
import org.springframework.beans.BeanUtils;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author: yu_sw
 * @Description: com.ysw.http系列.rest_template
 * @date:2022/5/20 21:55
 */
@RequestMapping
@Controller
public class ProvideController {


    @RequestMapping("/getForObject")
    @ResponseBody
    public User testGetForObject(User user,String name,Integer id){
        User target = new User();
        BeanUtils.copyProperties(user, target);
        return target;
    }

    @RequestMapping("/testForPost")
    @ResponseBody
    public User testGetForPost(@RequestBody User user, String name, Integer id){
        User target = new User();
        BeanUtils.copyProperties(user, target);
        return target;
    }

}
